include ../../../libs/mixins/form
include ../../../libs/mixins/area
include ../../../libs/mixins/grid
include ../../../libs/mixins/table

.message: .new
  +form("saveForm")
    +operateArea("新建推送任务")
    +form-group("推送任务名称：")
      +text("message", "description").message-name(validator="required, maxlength=30" maxlength-error-message="最多只允许输入 30个 字符")
    +form-group("计划推送时间：").message-push-mode
      label
        input(type="radio" ng-model="message.pushMode" value="now" name="payMode" ng-model-options="{updateOn:'default'}")
        span 立即推送
      label
        input(type="radio" ng-model="message.pushMode" value="other" name="payMode" ng-model-options="{updateOn:'default'}" ng-change="timeInput()")
        span 指定时间

    +form-group("").input-daterange.input-group.text-left(ng-if="message.pushMode == 'other'")
      +text("message", "pushTime")#pushTime
    +form-group("推送对象：").message-push-mode
      +select("message", "message.appPackage")(ng-options="key as val for (key, val) in pushObj"  validator="required")
      label
        input(type="radio" ng-model="message.isGlobal" value="true" name="global")
        span 所有用户
      label
        input(type="radio" ng-model="message.isGlobal" value="false" name="global")
        span 指定用户
      +textarea("message", "uidList")(cols="100" rows="5" ng-if="message.isGlobal == 'false'" validator="required" placeholder="请输入推送用户ID，多个ID之间用英文逗号","隔开")
      span(ng-if = "uidList == false && message.isGlobal == 'false'"): p.validation-invalid 输入内容只能包含数字和英文,
    +form-group("推送内容：")
      +textarea("message", "message.content")(validator="required")
    +form-group("跳转URL\n(可选)：")
      +text("message", "message.refer").message-name(placeholder="请输入http://开头的URL")
      span(ng-if = "http == false"): p.validation-invalid 请输入正确的链接
    .text-center
      +submit("完成", "btn.disabled")(validation-submit="saveForm" ng-click="save()")
      +cancel("取消")(ng-click="cancel()")

